﻿using System.Collections.Generic;
using OS.Common.Enums;

namespace OS.Common.Core
{
    public class PageListResult<T> : CustomResult where T : class, new()
    {
        /// <summary>
        /// 实体列表
        /// </summary>
        public List<T> Data { get; set; }

        /// <summary>
        /// 总数
        /// </summary>
        public long Total { get; set; }

        /// <summary>
        /// 构造函数
        /// </summary>
        public PageListResult()
        {

        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="resultType">结果枚举类型</param>
        /// <param name="message">消息</param>
        public PageListResult(ResultType resultType, string message = "")
            : base(resultType, message)
        {

        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="totalCount">总记录数</param>
        /// <param name="list">分页查询出的数据列表</param>
        public PageListResult(long totalCount, List<T> list)
        {
            Data = list;
            Total = totalCount;
        }
    }
}